package com.jiayi.sofarpcbootproject;

import com.alipay.sofa.rpc.config.ConsumerConfig;
import com.jiayi.sofarpcbootproject.service.HelloService;

public class QuickStartClient {

    public static void main(String[] args) {
        ConsumerConfig<HelloService> consumerConfig = new ConsumerConfig<HelloService>()
                .setInterfaceId(HelloService.class.getName())
                .setProtocol("bolt")
                .setDirectUrl("bolt://127.0.0.1:9696");

        //生成代理
        HelloService helloService = consumerConfig.refer();
        while (true){
            System.out.println(helloService.sayHello("world"));
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
